From: robertl Date: Sat, 13 Mar 2010 17:57:34 +0000 (+0000) Subject: Only whack "extension" from pathname, not dirname, in bushnell. (testo X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~199^2~38 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5f755d97eca4be072096894fc4da47adc7039b5b;p=gpsbabel.git Only whack "extension" from pathname, not dirname, in bushnell. (testo uses dots in directory names...) --- diff --git a/bushnell.c b/bushnell.c index 5bcdea821..de55ac18d 100644 --- a/bushnell.c +++ b/bushnell.c @@ -157,13 +157,14 @@ rd_deinit(void) { static void wr_init(const char *fname) { - char *dot; + char *dot, *slash; ofname = xstrdup(fname); - // If user provided an extension, whack it. - dot = strchr(ofname, '.'); - if (dot) *dot = 0; + // If user provided an extension in the pathname, whack it. + dot = strrchr(ofname, '.'); + slash = strrchr(ofname, GB_PATHSEP); + if (dot > slash) *dot = 0; static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" ".-/\\~@#$%^&*()_+=<>"